﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using motelmanagement.common;
using motelmanagement.dao;
using motelmanagement.bo;
using System.Data;
using System.Windows.Forms;

namespace motelmanagement.controller
{
    class RoleControl
    {
        RoleDAO roleDAO = new RoleDAO();
        public RoleBO getRole(String idRole) {
            RoleBO roleBO = null;
            roleBO = new RoleBO();
            DataTable tbl = roleDAO.getALLRole();
            if (tbl.Rows.Count > 0) {
                roleBO.RoleID = Convert.ToInt32(tbl.Rows[0]["role_id"]);
                roleBO.RoleName = Convert.ToString(tbl.Rows[0]["role_name"]);
            }
            return roleBO;
        }
        public void HienThi(DataGridView dg, BindingNavigator bn)
        {
            BindingSource bs = new BindingSource();
            DataTable tbl = roleDAO.getALLRole();
            bs.DataSource = tbl;
            dg.DataSource = bs;
            bn.BindingSource = bs;
        }
        
    }
}
